<?php

require_once 'users.php';

if (isset($_POST["submit"])) {
    $co = false;
    for ($i = 0; $i < count($users); $i++) {
        if (strcmp($_POST["username"], $users[$i]["username"]) == 0
                && strcmp($_POST["password"], $users[$i]["password"]) == 0) {
            $co = true;
            break;
        } else {
            $co = false;
        }
    }
    if ($co == true)
        echo $_POST["username"] . " welcom";
    else
        header("Location: http://localhost/anhchau-web1/login/login.php");
}
?>
